<?php
declare(strict_types=1);

namespace LowCode\Naive;

use LowCode\Naive;
use LowCode\Node;
use LowCode\Support\JsExp;
use LowCode\Traits\Props\HasTooltip;

/**
 * 文本省略 Ellipsis
 * @method static static make(mixed $children = null) Ellipsis组件
 */
class Ellipsis extends Naive
{

    use HasTooltip;

    public function __construct(mixed $children = null)
    {
        parent::__construct();
        $this->children($children);
    }

    /**
     * 更好性能的
     * @return $this
     */
    public function performant(): static
    {
        return $this->componentName("PerformantEllipsis");
    }

    /**
     * 展开的触发方式
     * @return $this
     */
    public function expandTrigger(): static
    {
        return $this->prop("expand-trigger","click");
    }

    /**
     * 最大行数
     * @param int|string|JsExp $lineClamp
     * @return $this
     */
    public function lineClamp(int|string|JsExp $lineClamp): static
    {
        return $this->prop("line-clamp",$lineClamp);
    }

    /**
     * Tooltip 的属性
     * @param Node $node
     * @return $this
     */
    public function slotTooltip(Node $node): static
    {
        return $this->addSlot($node,"tooltip");
    }

}
